<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <father-page></father-page>
  </div>
  <script src="./vue.global.js"></script>
  <script>
    const { createApp } = Vue;
    const app = createApp();
    // 子组件
    const ChildPage = {
      template: `
        <div>
          <header>
            <slot name="header"></slot>
          </header>
          <main>
            <slot></slot>
          </main>
          <footer>
            <slot name="footer"></slot>
          </footer>
        </div>
      `
    }
    const FatherPage = {
      template: `
        <div>
          <h2>这是父组件</h2>
          <child-page>
              <h2>这是默认内容</h2>
              <button>哈哈哈</button>
              <template #footer>
                  <mark>头部插槽内容</mark>
              </template>
              <template v-slot:header>
                  <button>头部插槽内容</button>
              </template>
              
          </child-page>
          
        </div>
      `,
      components: {
        ChildPage
      }
    }
    app.component('FatherPage', FatherPage)


    app.mount('#app')
  </script>
</body>

</html>